<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>后台管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../css/global.css?t=1488795362026" media="all">
    <link rel="stylesheet" href="../css/layui.css?t=1488795362026">
    <link rel="stylesheet" href="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/css/upload.css?t=1488795362026"  >
    <script src="../js/jquery.js"></script>
</head>

<body>
    <div class="layui-layout layui-layout-admin">


        <div class="layui-header header header-demo">
            <div class="layui-main"> <a class="logo" href="/"> </a>
                <ul class="layui-nav" pc>
                    <li class="right"> <span> 用户：hippo</span><a href="/logout" class="out">退出</a> </li>
                </ul>
            </div>
        </div>



        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <ul class="layui-nav layui-nav-tree site-demo-nav">
                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">基础内容管理</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/series/list">系列管理</a></dd>
                            <dd class=""><a href="/live/list">直播管理</a></dd>
                            <dd class=""><a href="/video/list">视频管理</a></dd>
                            <dd class=""><a href="/article/list">图文管理</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">聚合内容管理</a>
                        <dl class="layui-nav-child">

                            <dd class=""><a href="/competition/list">赛事管理</a></dd>
                            <dd class=""><a href="/organization/list">机构管理</a></dd>

                            <dd class=""><a href="/feed/list">标准列表管理</a></dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">Tab管理</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/f1/article/list">F1管理</a></dd>
                            <dd class=""><a href="/ad/list">F1 Banner</a></dd>
                            <dd class=""><a href="/ad/start/list">启动屏广告</a></dd>
                            <dd class=""><a href="/f1/sorting/list">F1排序</a></dd>
                            <dd class=""><a href="/f2/sorting/list">F2-Tab1排序</a></dd>
                            <dd class=""><a href="/f2/recordSorting/list">F2-Tab2排序</a></dd>
                            <dd class="layui-this"><a href="/channel/list">F3频道管理</a></dd>
                        </dl>
                    </li>


                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">运营管理</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/review/list">评论管理</a></dd>
                            <dd class=""><a href="/user/message/home">系统消息</a></dd>
                            <dd class=""><a href="/feedback/list">用户反馈</a></dd>
                        </dl>
                    </li>


                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">统计信息</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/statistics/result/list">统计信息</a></dd>
                        </dl>
                    </li>


                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">用户管理</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/user/list">用户管理</a></dd>
                        </dl>
                    </li>


                    <li class="layui-nav-item layui-nav-itemed"><a class="javascript:;" href="javascript:;">系统管理</a>
                        <dl class="layui-nav-child">
                            <dd class=""><a href="/admin/user/list">后台帐号管理</a></dd>
                            <dd class=""><a href="/multi_app/list">App管理</a></dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item" style="height: 30px; text-align: center"></li>
                </ul>
            </div>
        </div>

        <div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
            <div class="layui-body layui-tab-content site-demo site-demo-body">
                <div class="mian">
                    <a class="layui-btn layui-btn-small layui-btn-danger" href="ad_list.html">返回广告管理</a>
                    <form class="layui-form enen" action="/channel/save.json">
                        <div class="title">添加广告</div>
                        <input type="hidden" name="channelId" value="0" class="layui-input">
                        <input type="hidden" name="status" value="0" class="layui-input">
                        <div class="layui-form-item">
                            <label class="layui-form-label">名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" value="" required lay-verify="required" placeholder="请输入名称"
                                    autocomplete="off" class="layui-input" style="width:400px;">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">广告类型：</label>
                            <div class="layui-input-block" style="float:left; margin-left:0px;">
                                <input type="radio" name="targetType" value="5" title="图片广告">
                                <input type="radio" name="targetType" value="6" title="视频广告">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">上传图片：</label>
                            <div class="img btn_upload">


                                <img src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/images/tp/img_load.png">

                                <div class="layui-input-block" style="opacity:0">
                                    <input name="icon" type="hidden" value="" class="_up_tb">
                                    <input type="file" name="imgFile" lay-type="file" class="layui-upload-file" style="width:263px; height:165px; ">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item vido_upload">
                            <label class="layui-form-label">上传视频：</label>
                            <div class="layui-input-block up_video">
                                 <div style="line-height:36px;">1111111</div>
                                <input type="radio" name="myradio" value="random_name" checked=true style="display:none" />
                                <input type="hidden" name="videoId" class="videoId">
                                <div id="ossfile">你的浏览器不支持flash,Silverlight或者HTML5！</div>
                                <div id="container"><a id="selectfiles" href="javascript:void(0);" class='btn'>选择文件</a>
                                    <a id="postfiles" href="javascript:void(0);" class='btn'>开始上传</a> </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">跳转URL：</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" value="" required lay-verify="required" placeholder="请输入名称"
                                    autocomplete="off" class="layui-input" style="width:400px;">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">投放位置</label>
                            <div class="layui-input-block" style="width:200px">
                                <select name="city" lay-verify="required">
                                    <option value=""></option>
                                    <option value="0">北京</option>
                                    <option value="1">上海</option>
                                    <option value="2">广州</option>
                                    <option value="3">深圳</option>
                                    <option value="4">杭州</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">支持平台：</label>
                            <div class="layui-input-block" style="float:left; margin-left:0px;">
                                <input type="radio" name="targetType" value="5" title="IOS">
                                <input type="radio" name="targetType" value="6" title="Android">
                                <input type="radio" name="targetType" value="6" title="不限">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">上线时间：</label>
                            <div class="layui-input-block">
                                <input class="layui-input" placeholder="自定义日期格式" style="width:200px;" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">下线时间：</label>
                            <div class="layui-input-block">
                                <input class="layui-input" placeholder="自定义日期格式" style="width:200px;" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排行权重：</label>
                            <div class="layui-input-block" style="width:120px;">
                                <input type="text" name="weight" value="0" required lay-verify="required" placeholder="请输入排行权重"
                                    autocomplete="off" class="layui-input" style="width:200px;">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>


        <div class="layui-footer footer footer-demo">
            <div class="layui-main">
                <p>2017 &copy; <a href="/">layui.com</a> MIT license</p>
            </div>
        </div>
        <div class="site-tree-mobile layui-hide"> <i class="layui-icon">&#xe602;</i> </div>
        <div class="site-mobile-shade"></div>
    </div>
    <script src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/layui.js"></script>
    <script src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/fun.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/lib/crypto1/crypto/crypto.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/lib/crypto1/hmac/hmac.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/lib/crypto1/sha1/sha1.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/lib/base64.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/lib/plupload-2.1.2/js/plupload.full.min.js"></script>
    <script type="text/javascript" src="http://hippostatic.oss-cn-beijing.aliyuncs.com/admin/js/upload.js"></script>

    <script>
        layAjax.init()
        $(".btn_upload").each(function (index, element) {
            var btn = $(this).find("img");
            var file = $(this).find(".layui-upload-file");
            btn.click(function () {
                file.click();
                window.self = $(this);
            })
            layui.use('upload', function () {
                layui.upload({
                    url: '/upload/image.json',
                    elem: file //指定原始元素，默认直接查找class="layui-upload-file"
                        ,
                    method: 'post' //上传接口的http类型
                        ,
                    success: function (res) {
                        $(window.self).parents(".btn_upload").find("[type=hidden]").val(res
                            .url)
                        $(window.self).parents(".btn_upload").find("img").attr("src", res.url)
                    }
                });
            });
        });
        layui.use('form', function () {
            var form = layui.form();
            form.on('switch(switchTest)', function (data) {
                layer.tips('开关checked：' + (this.checked ? 'true' : 'false'), data.othis)
            });
            //提交表单
            form.on('submit(formDemo)', function (data) {
                //layer.msg(JSON.stringify(data.field));
                $.ajax({
                    url: "/channel/save.json",
                    data: data.field,
                    type: "POST",
                    dataType: "json",
                    success: function (data) {
                        layer.msg(data.resmsg);
                        if (data.rescode == 0) {
                            setTimeout(function () {
                                location = "/channel/list";
                            }, 500)
                        }
                    },
                    error: function (er) {
                        BackErr(er);
                    }
                });
                return false;
            });
        });
        //新增加201810
        function hideH5() {
            $(".vido_upload").hide()
            $(".vido_upload").attr("lay-verify", "")
        }
        hideH5()
        function showH5() {
            $(".vido_upload").show();
            $(".vido_upload").attr("lay-verify", "required")
        }
        $(".layui-input-block").on('click', '.layui-unselect', function () {
            var text = $(this).find("span").text();
            if (text == "视频广告") {
                showH5()
            } else {
                hideH5()
            }
        });
        function uploadCallback(up, file, info){
        //将视频文件名字放到隐藏域
         $(".videoId").val(validate(get_uploaded_object_name(file.name)).replace(/vod\//g,""))
        }
    </script>


</body>

</html>